package cn.gov.pbc.gd.credit.provider.api.report.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import com.liu.jbase.PageListVo;
import com.liu.jbase.service.db.impl.DBBaseServiceImpl;

import cn.gov.pbc.gd.credit.api.report.IReportQueryApi;
import cn.gov.pbc.gd.credit.provider.dao.report.IReportQueryDao;
import cn.gov.pbc.gd.credit.vo.report.query.ReportQueryVo;
import cn.gov.pbc.gd.credit.vo.report.query.ResQueryDetailVo;
import cn.gov.pbc.gd.credit.vo.report.query.ResQueryTotalVo;

@Service
public class ReportQueryApiImpl extends DBBaseServiceImpl<ResQueryTotalVo, ReportQueryVo, IReportQueryDao> implements IReportQueryApi{

	@Autowired
	private IReportQueryDao reportQueryDao;
	
	@Override
	public List<ResQueryTotalVo> queryTotal(ReportQueryVo vo) {
		
		return reportQueryDao.queryTotal(vo);
	}

	@Override
	public List<ResQueryDetailVo> queryList(ReportQueryVo vo) {
		
		return reportQueryDao.queryList(vo);
	}

	@Override
	public PageListVo<ResQueryDetailVo> pageList(ReportQueryVo vo, PageListVo<ResQueryDetailVo> page) {
		
		PageListVo<ResQueryDetailVo> list = null;
		 
        PageBounds pageBounds = new PageBounds(page.getCurrPage(), page.getPageSize());
        PageList<ResQueryDetailVo> pageList = reportQueryDao.pageList(vo, pageBounds);
        list = new PageListVo<ResQueryDetailVo>(pageList.getPaginator().getTotalCount(), pageList, page.getCurrPage(), page.getPageSize());
		
		return list;
	}

}
